import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		cookie: '',
	},
	mutations: {
		login(state, cookie) {
			state.cookie = cookie
			uni.setStorage({
				key: 'cookie',
				data: cookie
			})
		},
		logout(state) {
			state.cookie = ''
			uni.removeStorageSync('cookie')
		}
	}
})
export default store
